package com.group4.datafactorybackend.util;

import cn.hutool.core.util.RandomUtil;

/**
 * @author xin
 * @date 2022/7/20 10:49
 * @update 卑微小峰
 * @data 2022/7/29  16:00
 */
public class CodeUtil {
    public static String getCode() {
        return RandomUtil.simpleUUID();
    }
    public static String getCode(String prefix ,String id) {
        switch (id.length()){
            case 1:
                return prefix + "0000" + id;
            case 2:
                return prefix + "000" + id;
            case 3:
                return prefix + "00" + id;
            case 4:
                return prefix + "0" + id;
            case 5:
                return prefix + id;
            default:
                throw new IllegalStateException("Unexpected value: " + id.length());
        }
    }
}
